<?php 

require('include/top.php');

//$comments = Comment::getAll();

$user = new User('1');

$articles = Article::getAll();


//$article = $articles[0];
//$bool = $article->delete(1);

session_start();

if ( (isset($_POST['login']) && !isset($_POST['mdp'])) || (isset($_POST['mdp']) && !isset($_POST['login'])) )
{
	include('templates/login.tpl.php');
	echo("Rentre tes informations avant de cliquer sur OK !");
}
else if(isset($_POST['login']) && isset($_POST['mdp']))
{
	if($_POST['login'] == $user->nickname)
	{
		if ($_POST['mdp'] != $user->password)
		{
			echo("Mauvais MDP");
			include('templates/login.tpl.php');
		}
		else
		{
			$_SESSION['user'] = 1;
			include('templates/header.tpl.php');
			include('templates/content.tpl.php');
			include('templates/footer.tpl.php');
		}
	}
	else
	{
		echo("C'est pas ça ton nom");
		include('templates/login.tpl.php');
	}
} 
else
{
	include('templates/header.tpl.php');
	include('templates/content.tpl.php');
	include('templates/footer.tpl.php');
}
?>